<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<div style="position:absolute;left:210px;">
    <span class="layui-breadcrumb">
<%--      <a href="${pageContext.request.contextPath }">首页</a>--%>
<%--      <a><cite>学生管理</cite></a>--%>
    </span>
</div>
<form style="margin-left:210px;margin-top:25px" class="layui-form layui-form-pane" action="${pageContext.request.contextPath}/stu/fuzzyQueryStu ">
    <input type="hidden" name="method" value="list">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="stuName" lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -100px">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-inline">
                <input type="text" name="mobile" lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -100px">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-inline">
                <select name="sex">
                    <option value="" selected="selected"></option>
                    <option value="F">男</option>
                    <option value="M">女</option>
                </select>
                <%--                <input type="text" name="" lay-verify="required" autocomplete="off" class="layui-input" value="">--%>
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -140px">
            <label class="layui-form-label">年龄</label>
            <div class="layui-input-inline">
                <input type="text" name="age" lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -120px">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-inline">
                <input type="text" name="idNum" lay-verify="required" autocomplete="off" class="layui-input" value="">
            </div>
        </div>

<%--        <div class="layui-inline">--%>
<%--            <div class="layui-input-inline">--%>
<%--                <input class="layui-btn" id="get" type="submit">--%>
<%--            </div>--%>
<%--        </div>--%>

        <input type=submit value="提交">
    </div>
</form>
<div style="position:absolute;left:210px;top:130px;">
    <div class="layui-col-md10">
        <!-- 使用分页时需要定义:lay-filter="graduate-list -->
        <table class="layui-table" lay-data="{width:1350}" lay-size="lg" lay-filter="form-list" id="tb">
            <thead>
            <tr>
                <th lay-data="{type:'numbers'}">学号</th>
                <th lay-data="{field:'graduateName',align:'center',unresize:true,sort:true,width:120}">学生姓名</th>
                <th lay-data="{field:'phone',align:'center',unresize:true,sort:true,width:120}">手机号</th>
                <th lay-data="{field:'sex',align:'center',unresize:true,sort:true,width:80}">性别</th>
                <th lay-data="{field:'old',align:'center',unresize:true,sort:true,width:80}">年龄</th>
                <th lay-data="{field:'id',align:'center',unresize:true,sort:true,width:100}">证件类型</th>
                <th lay-data="{field:'hao',align:'center',unresize:true,sort:true,width:120}">证件号码</th>
                <th lay-data="{field:'birthday',align:'center',unresize:true,sort:true,width:120}">出生日期</th>
                <th lay-data="{field:'creatTime',align:'center',unresize:true,sort:true,width:120}">创建时间</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:120}">修改时间</th>
                <th lay-data="{field:'location',align:'center',unresize:true,sort:true,width:185}">籍贯</th>
                <th lay-data="{field:'edit',align:'center',unresize:true,sort:true,width:130}">操作</th>
            </tr>
            </thead>
            <tbody>
<%--            <c:forEach var="stu" items="${stu}">--%>
<%--                <tr>--%>

<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.stuNum}</span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.stuName}</span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.mobile}</span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878"><c:if test="${stu.sex=='F'}">男</c:if></span>--%>
<%--                        <span style="color: #5FB878"><c:if test="${stu.sex=='M'}">女</c:if></span>--%>

<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.age}</span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878"> <c:if test="${stu.idType=='ok'}">身份证</c:if></span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.idNum}</span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878"><fmt:formatDate value="${stu.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate> </span>--%>
<%--                    </td>--%>

<%--                    <td>--%>
<%--                        <span style="color: #5FB878"><fmt:formatDate value="${stu.createDate}" pattern="yyyy-MM-dd"></fmt:formatDate></span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878"><fmt:formatDate value="${stu.updateDate}" pattern="yyyy-MM-dd"></fmt:formatDate></span>--%>
<%--                    </td>--%>
<%--                    <td>--%>
<%--                        <span style="color: #5FB878">${stu.province}${stu.city}${stu.area}</span>--%>
<%--                    </td>--%>


<%--                    <td>--%>
<%--                        <a style="color: #FFB800" href="javascript:;">查看</a>&nbsp;--%>
<%--                        <a style="color: #368ED6" href="javascript:;">修改</a>&nbsp;--%>
<%--                        <a style="color: #ff5722" href="javascript:;">删除</a>--%>
<%--                    </td>--%>
<%--                </tr>--%>
<%--            </c:forEach>--%>
            </tbody>
        </table>
    </div>
</div>

<!-- 使用分页时需要引入分页js -->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/page.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/libs/layer/layer.js"></script>
<script type="text/javascript">


    $(function (){
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/stuu/findAllStu",
            dataType: "json",
            success:function (data){
                for (let i = 0; i < data.length; i++) {
                    let tr = $("<tr><td>"+data[i].stuNum+"</td><td>"+data[i].stuName+"</td><td>"+data[i].mobile+"</td><td>"+data[i].sex+"</td><td>"+"</td><td>"+data[i].age+"</td><td>"+"</td><td>"+data[i].idType+"</td><td>"+"</td><td>"+data[i].idNum+"</td><td>"+"</td><td>"+data[i].birthday+"</td><td>"+"</td><td>"+data[i].createDate+"</td><td>"+"</td><td>"+data[i].updateDate+"</td><td><a onclick='showOneStu("+data[i].stuId+")' href='javascript:;'>查看</a>"+
                    "<a onclick='selStu("+data[i].stuId+")' href='javascript:;'>修改</a>"+
                        "<a onclick='delStuu("+data[i].stuId+")' href='javascript:;'>删除</a></td></tr>");
                    console.log("全查数据"+tr);
                    $("table").append(tr);
                }
            },
            error:function (e){
                alert("请求错误");
            }
        })
    })


</script>

